package dao.impl;

import dao.ITreeDao;
import model.Tree;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public class TreeDao implements ITreeDao {
    @Autowired
    private SqlSession sqlSession;

    @Override
    public List<Tree> query(Tree tree) {
        return sqlSession.selectList("dao.ITreeDao.query", tree);
    }

    @Override
    public int insert(Tree tree) {
        return  sqlSession.insert("dao.ITreeDao.insert", tree);
    }

    @Override
    public int update(Tree tree) {
        return  sqlSession.update("dao.ITreeDao.update", tree);
    }

    @Override
    public int delete(Tree tree) {
        return  sqlSession.delete("dao.ITreeDao.delete", tree);
    }
}
